//=============================================================================
// ShieldSphere - Absorbs hits.
//=============================================================================
class ShieldSphere extends Actor;

var SentinelShield Shield;

replication
{
    reliable if(Role==Role_Authority)
        Shield;
}

//Intercept damage before Sentinel is hit.
function TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
{
	if(Shield != None)
		Shield.ShieldAbsorb(Damage, EventInstigator, HitLocation, Momentum, DamageType);
}

//Make sure projectiles explode (or whatever they do when they hit solid walls) when they hit the shield.
singular function Touch(Actor Other)
{
	if(Other == None || !Other.IsA('Projectile'))
		return;

	//Don't block own projectiles on way out.
	if(Other.Owner == Shield.Sentinel)
		return;

	Other.SetLocation(Other.Location + normal(Other.Location - Location) * 20); //Hack to stop grenades and things bouncing multiple times on contact.
	Other.HitWall(normal(Other.Location - Location), self);

	//For hit effects.
	if(Shield != None)
		Shield.ShieldAbsorb(0, None, Other.Location, vect(0, 0, 0), class'DamageType');
}

defaultproperties
{
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'TFMedia.CollisionSphere'
     bAcceptsProjectors=False
     DrawScale=1.200000
     bUnlit=True
     bHardAttach=True
     bCollideActors=True
     bProjTarget=True
}
